package com.ruoyi.web.controller;

import com.ruoyi.web.controller.Util.AuthenticationUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 身份证验证接口
 */
@Controller
@RequestMapping("/system/authentication")
public class AuthenticationController {
    @PostMapping("/getmessage")
    @ResponseBody
    public String getList(@RequestParam("idcard") String idcard,
                          @RequestParam("name") String name) {
        Map<String, String> params = new HashMap<>();
        params.put("idcard", idcard);
        params.put("name", name);
        AuthenticationUtil authenticationUtil = new AuthenticationUtil();
        try {
            String result = authenticationUtil.postForm(params);
            return result;
        } catch (IOException e) {
            return e.getMessage();
        }
    }
}
